// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
// import VueResource from 'vue-resource'
// Vue.use(VueResource)
Vue.config.productionTip =false
Vue.use(ElementUI);
Vue.use(VueQuillEditor)
/* eslint-disable no-new */
// 这里判断再跳转到login

// ElementUI.Message('账号和密码不能为空')  能这样提示信息
router.beforeEach((to, from, next) => {
  // console.log(to)
  // console.log(to.path)
  // console.log(from)
  if (to.path == '/login') {
    sessionStorage.removeItem('userInfo');
  }
  let userInfo = JSON.parse(sessionStorage.getItem('userInfo'));
  console.log(userInfo)
  if (!userInfo && to.path != '/login') {
    console.log('测试')
    next({path: '/login'});
  } else {
    console.log('下一步')
    next();
  }
});
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
